<?php
namespace app\mini_api\controller;

class Permission extends Api
{
    public function _initialize()
    {
        parent::_initialize();
    }

    public function check()
    {
        $token = $_SERVER['HTTP_TOKEN'];
        // $token = $this->input_data['token'];

        if($token == '')
        {
            $err = [
                'code' => 10001,
                'data' => '登录状态无效，请重新登录'
            ];
            $this->res($err);
        }
        $map['token'] = $token;

        if( ! $user = db('Driver')->where($map)->find() )
        {
            $err = [
                'code' => 10001,
                'data' => '登录状态无效，请退出重新登录'
            ];
            $this->res($err);
        }
        else
        {
            
            $this->user = $user;
        }
    }


}
